// 1. 「类型 + 方括号」表示法
const arr1: string[] = [
	"hello",
	// 111, // 报错
	// true // 报错
];

const arr2: (string | number)[] = [
	"hello",
	111,
	// true, // 报错
];

interface Person {
	name: string;
	age: number;
}

const arr3: Person[] = [
	{
		name: "jack",
		age: 18,
	},
];

// 2. 数组泛型
const arr4: Array<string> = ["hello123"];
const arr5: Array<string | number> = ["hello123", 1111];

// 3. 用接口表达数组
interface Arr {
	[index: number]: number;
}

const arr6: Arr = [1, 2, 3];

// 类型推论
const arr7 = [1, 2, 3, "string", true, { name: "jack" }];
const arr8 = [];

interface Route {
	path: string;
	name: string;
	redirect?: string;
	meta: {
		title: string;
		icon?: string;
	};
	children?: Route[];
}

const asyncRoutes: Route[] = [
	{
		path: "/acl",
		name: "Acl",
		redirect: "/acl/user/list",
		meta: {
			title: "权限管理",
			icon: "user",
		},
		children: [
			{
				path: "user/list",
				name: "User",
				meta: {
					title: "用户管理管理",
				},
			},
		],
	},
];
